-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resize preference save sequence #233
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: 4dbf668 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Preview URLsGH Env: preview |
joelamb
commented
Sep 19, 2023
joelamb
force-pushed
the
resize-preference-save-sequence
branch
from
September 19, 2023 13:40
40a9bd4
to
1ebd8de
Compare
joelamb
requested review from
camskene,
nicolechung,
ynotdraw,
danwenzel and
clintcs
September 19, 2023 13:54
ynotdraw
reviewed
Sep 19, 2023
nicolechung
reviewed
Sep 19, 2023
nicolechung
reviewed
Sep 19, 2023
nicolechung
reviewed
Sep 19, 2023
the queueUpdate was uses requestFrameAnimation to schedule the calls to the resize columns function. To ensure that the call to save preferences is called after the resize the queueUpdate now takes an optional callback function that is called after the resize. This ensures that these pseudo-async events are always performed in a predictable and correct sequence.
Test helpers simplified since we now handle test waiting in the queueUpdate function of the resize handle. Column resizing test updated to affect multiple columns and more explicitly check the width of the adjusted columns, not just verify the delta.
joelamb
force-pushed
the
resize-preference-save-sequence
branch
from
September 20, 2023 08:35
7bb7613
to
e455891
Compare
ynotdraw
approved these changes
Sep 20, 2023
clintcs
approved these changes
Sep 20, 2023
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Turns out that this: #211 (comment) came back to bite us! The test was passing, but waiting in the test-helper was masking the resizing behaviour and causing unpredictable column resizing when interacting with tables.
What was happening:
Calling the resize function via a
requestAnimationFrame
in thequeueUpdate
pushes it into the next animation frame, however, the call to save the preferences was then happening ahead of it, so the saved values did not reflect the resizing.We'd created a pseudo-async sequence.
How these changes fix it:
So, to ensure that preferences are saved after we have completed resizing, we pass the save function as a callback to the queueUpdate that can then be called in the requestAnimationFrame callback after the resize function.
Because the requestAnimationFrame hides these function call from he ember test waiter, we ensure that we track them by also cancelling the waiter in the requestAnimationFrame callback function.